<template>
  <div id="app">
    <h2>我是App 组件</h2><br>
    <h1>{{ $store.state.counter }}</h1>
    <h1>乘2的数据是 : {{ $store.getters.dataTake }}</h1>

    <!--    路由开始跳转-->
    <router-link to="/home">首页</router-link>
    <br>
    <!--    地址后面加上变量 , 可以向路由赋值-->
    <!--    <router-link :to="'/user/'+ userid">用户</router-link>-->

    <!--    &lt;!&ndash;    传参数的第二中方式  , 传送对象的方式来进行传送参数&ndash;&gt;-->
    <!--    <router-link :to="{path:'/profile',query:{name:username,age:userage}}">档案</router-link>-->

    <button @click="userclick">用户</button>
    <button @click="profileclick">档案</button>

    <!--    路由显示的页面-->
    <router-view></router-view>

  </div>
</template>

<script>

export default {
  name: 'App',
  components: {},
  data() {
    return {
      userid: "1234567",
      username: "张三",
      userage: 18
    }
  },
  methods: {
    userclick() {
      this.$router.push("/user/" + this.userid)
    },
    profileclick() {
      this.$router.push({
        path: "/profile",
        query: {
          name: this.username,
          age: this.userage
        }

      })
    }

  }
}
</script>

<style>
html,
body {
  margin: 0%;
  height: 100%;
}

#app {
  height: 100%;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
